<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="navbar navbar-inverse">
  <div class="navbar-inner">
    <a class="brand" href="#">海底捞餐饮</a>
    <ul class="nav">
      <li class="active"><a href="#">首页</a></li>
      <li><a href="#">Link</a></li>
      <li><a href="#">Link</a></li>
      <li class="divider-vertical"></li>
      <li>
      	<form id="form1" class="navbar-search pull-left">
		  <input type="text" class="search-query" list="list" name="query" placeholder="Search" onkeydown="search(this,event);" />
		  <datalist id="list">
		  	<option label="ppk" value="ppk"></option>
		  	<option label="ppk" value="ppk"></option>
		  	<option label="ppk" value="ppk"></option>
		  	<option label="ppk" value="ppk"></option>
		  	<option label="ppk" value="ppk"></option>
		  </datalist>
		</form>
		<script type="text/javascript">
			function search(put,e){
				if(e.keyCode==13&&put.value!=""){
					alert("hello");
					$.post("search.jsp",{"query":"query"},function(){
					});
				}else{
					$("#form1").submit(function(){
						return false;
					});
				}
			}
		</script>
      </li>
    </ul>
    <c:if test="${user.name}">
	   	<ul class="nav pull-right">
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
	          <ul class="dropdown-menu">
	            <li><a href="#">Action</a></li>
	            <li><a href="#">Another action</a></li>
	            <li><a href="#">Something else here</a></li>
	            <li class="divider"></li>
	            <li><a href="#">Separated link</a></li>
	          </ul>
	        </li>
	      </ul>
    </c:if>
  </div>
</div>
